﻿@{
    var bloginfo = @ViewData["bloginfo"] as Jhong.FunMVCBlog.Admin.Model.BlogInfoViewModel;
}
<style>
    .myTag {
        padding-top: 40px;
    }

    .btn {
        float: right !important;
        margin-right: 2px;
    }
</style>
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">网站设置</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="row">
    <div class="col-lg-12">
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#a">修改个人信息</a></li>
            <li><a data-toggle="tab" href="#b">修改密码</a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane fade in active myTag" id="a">
                <form action="/Setting/ChangePersonThumbnail" method="post" class="form-horizontal" enctype="multipart/form-data">
                    <div class=" form-group">
                        <label for="personThumbnail" class="col-sm-2 control-label">修改头像</label>
                        <div class="col-sm-5">
                            <input accept=".png,.jpg,.jpeg,.gif,.bmp" type="file" style="float:left;width:80%;" class="form-control" name="personThumbnail" id="personThumbnail" placeholder="原始密码">
                            <button type="submit" style="float:left" class="btn btn-default">上传</button>
                        </div>
                    </div>
                </form>
                <hr />
                <form class="form-horizontal" id="f1">
                    <div class=" form-group">
                        <label for="spwd" class="col-sm-2 control-label">修改站点信息</label>
                        <div class="col-sm-5">
                        </div>
                    </div>
                    <div class=" form-group">
                        <label for="spwd" class="col-sm-2 control-label">博客名称</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" name="BlogName" value="@bloginfo.BlogName" placeholder="博客名称">
                        </div>
                    </div>
                    <div class=" form-group">
                        <label for="spwd" class="col-sm-2 control-label">个人昵称</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" name="NickName" value="@bloginfo.NickName" placeholder="个人昵称">
                        </div>
                    </div>
                    <div class=" form-group">
                        <label for="spwd" class="col-sm-2 control-label">个人主页</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" name="HomePage" value="@bloginfo.HomePage" placeholder="个人昵称">
                        </div>
                    </div>
                    <div class=" form-group">
                        <label for="spwd" class="col-sm-2 control-label">个人简介</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control" name="About" value="@bloginfo.About" placeholder="个人昵称">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"></label>
                        <div class="col-sm-5">
                            <button type="button" id="sv1" class="btn-primary btn">保存</button>
                        </div>
                    </div>
                </form>
            </div>
            <!---->
            <div class="tab-pane fade myTag" id="b">
                <form class="form-horizontal" id="f2">
                    <div class=" form-group">
                        <label for="spwd" class="col-sm-2 control-label">原始密码</label>
                        <div class="col-sm-5">
                            <input type="password" class="form-control" name="spwd" id="spwd" placeholder="原始密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="account" class="col-sm-2 control-label">新登陆账号</label>
                        <div class="col-sm-5">
                            <input type="password" class="form-control" name="account" id="account" placeholder="新登陆账号">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="npwd" class="col-sm-2 control-label">新密码</label>
                        <div class="col-sm-5">
                            <input type="password" class="form-control" name="npwd" id="npwd" placeholder="新密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="rpwd" class="col-sm-2 control-label">再输一次</label>
                        <div class="col-sm-5">
                            <input type="password" class="form-control" name="rpwd" id="rpwd" placeholder="再输一次">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"></label>
                        <div class="col-sm-5">
                            <button type="button" id="sv2" class="btn-primary btn">保存</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    (function ($) {
        $("#sv1").click(function () {
            var data = $("#f1").serialize();
            $.post("/Setting/ChangeBlogInfo", data, function (res) {
                alert(res.Msg);
            });
            return false;
        });
    }(jQuery));

    (function ($) {
        $("#sv2").click(function () {
            var data = $("#f2").serialize();
            $.post("/Setting/ReSetPwd", data, function (res) {
                alert(res.Msg);
                return false;
            });
            return false;
        });
    }(jQuery));
</script>